//
//  HDBasicServiceHelper
//
//  Created by kopuCoder on 17/3/17.
//  Copyright © 2017年 kopuCoder. All rights reserved.
//  基础信息工具 ：主要包括地理位置获取(地理编码反地理编码)、通讯录获取、手机基本信息获取

#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
#define kGPSAuthorInfo  @"当前定位权限处于关闭状态,请授权GPS定位"
#define kDeviceGPSServiceInfo @"请打开GPS定位服务"
//#define kDeviceAddressBookInfo @"请授权访问通讯录"

#define kDeviceAuthorFlag @"授权提示"



/**
 兼容iOS10.0定位权限设置:
 
 兼容iOS10.0版本需要在Info.plist里面加上2项中的一项
 NSLocationAlwaysUsageDescription      String 你的提示文案
 NSLocationWhenInUseUsageDescription   String 你的提示文案
 */

/**
 兼容iOS10.0通讯录权限设置:
 
 兼容iOS10.0版本需要在Info.plist里面加一项：
 NSContactsUsageDescription      String 提示访问通讯录的提示文案
 */

@class HDPlacemark;
typedef void (^GPSCoorClosure) (CLLocationDegrees latitude, CLLocationDegrees longitude);
typedef void (^GPSPlacemarkClosure) (  HDPlacemark * _Nullable  placemark);

#pragma mark ---Person Model---
@interface HDPerson : NSObject
@property (nonatomic,copy,nullable)NSString * name;
@property (nonatomic,copy,nullable)NSString * email;
@property (nonatomic,strong,nullable)NSMutableArray<NSString *>* phoneNumbers;
@end


@interface HDPlacemark : NSObject
@property (nonatomic,copy,nullable) NSString *country;
@property (nonatomic,copy,nullable) NSString *province;
@property (nonatomic,copy,nullable) NSString *city;
@property (nonatomic,copy,nullable) NSString *county;
@property (nonatomic,copy,nullable) NSString *address;
@property (nonatomic, assign) int placemarkId;
@property (nonatomic,copy,nullable) NSString *type;

/** 新增经纬度*/
@property (nonatomic,assign)CLLocationDegrees latitude;
@property (nonatomic,assign)CLLocationDegrees longitude;


- ( NSString * _Nullable  )getProvinceAndCity;

+ (HDPlacemark * _Nonnull )initWithCLPlacemark:(CLPlacemark * _Nonnull )placemark;
@end

#pragma mark ---设备信息模型---

@interface HDDeviceModel : NSObject

/**<#desc#>*/
@property (nonatomic,copy,nullable) NSString * DeviceAdvertisingIdentifier;

@property (nonatomic,copy,nullable) NSString * DeviceUUID;

@property (nonatomic,copy,nullable) NSString * DeviceUserName;

@property (nonatomic,copy,nullable) NSString * DeviceSystemName;

@property (nonatomic,copy,nullable) NSString * DeviceVersion;

@property (nonatomic,copy,nullable) NSString * DeviceModel;

@property (nonatomic,copy,nullable) NSString * DeviceLocalModel;

@property (nonatomic,copy,nullable) NSString * AppName;

@property (nonatomic,copy,nullable) NSString * AppVersion;

@property (nonatomic,copy,nullable) NSString * AppVersionNum;

@property (nonatomic,copy,nullable) NSString * AppInfo;

@property (nonatomic,copy,nullable) NSString * DeviceModelName;
//IP地址
@property (nonatomic,copy,nullable) NSString * deviceIPAdress;
//当前手机连接的WIFI名称(SSID)
@property (nonatomic,copy,nullable) NSString * WifiName;
//获取当前连接Wi-Fi名称与MAC地址
@property (nonatomic,copy,nullable) NSString * fetchSSIDInfo;

@end




@interface HDCommonInfoHelper : NSObject<CLLocationManagerDelegate>

#pragma mark ---address book---
/**检查系统通讯录权限*/
//+(void)CheckAddressBookAuthorization:(nullable void (^)(bool isAuthorized))block;
//
///**获取系统通讯录信息*/
//+ (void)getSystemAddressBookInfoWithCallBack:(nullable void(^)(BOOL hasAuthor,NSArray<HDPerson *> * _Nonnull books))callBack;



#pragma mark ---system GPS sevice---

/**请求定位授权 --->弹窗显示请求授权*/
+ (void)requestGPSWhenInUseAuthorization;


/**获取系统GPS定位信息：经纬度、反地理编码*/
+ (void)getSystemGPServiceWithCallBack:(nullable void(^)(BOOL hasAuthor,CLLocationCoordinate2D coordinate,HDPlacemark * _Nullable reverseLocation))callBack;

// 反向地理编码获取地址信息
+ (void)getPlacemarkWithLatitude:(NSString * _Nonnull)latitude longitude:(NSString * _Nonnull)longitude closure:(nullable GPSPlacemarkClosure)closure;

// 地理编码获取经纬度
+ (void)getGPSLocationWithAddress:(NSString * _Nonnull)address closure:(nullable GPSCoorClosure)closure;


#pragma mark ---Device basic info---

+ (HDDeviceModel *)getCurrentDeviceInfoModel;

+ (NSString * _Nonnull)getDeviceAdvertisingIdentifier;
+ (NSString * _Nonnull )getDeviceUUID;

+ (NSString * _Nonnull )getDeviceUserName;

+ (NSString * _Nonnull )getDeviceSystemName;

+ (NSString * _Nonnull )getDeviceVersion;

+ (NSString * _Nonnull )getDeviceModel;

+ (NSString * _Nonnull )getDeviceLocalModel;

+ (NSString * _Nonnull )getAppName;

+ (NSString * _Nonnull )getAppVersion;

+ (NSString * _Nonnull )getAppVersionNum;

+ (NSString * _Nonnull )getAppInfo;

+ (NSString * _Nonnull )getDeviceModelName;

//IP地址
+ (nullable NSString *)deviceIPAdress;

//当前手机连接的WIFI名称(SSID)
+ (nullable NSString *)getWifiName;

//获取当前连接Wi-Fi名称与MAC地址
+(nullable id)fetchSSIDInfo;

//获取当前连接Wi-Fi的IP地址
+ (nullable NSString *)getIPAddress:(BOOL)preferIPv4;





@end
